package com.springboot.springboot4.Servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ClassName:
 * @author: CKC
 * @DateTime: 2021/1/30 14:38
 *
 * 方法一：
 * springBoot 原生servlet  API 的注入  (servlet   filter   listener
 * @WebServlet
 * @WebFilter
 * @WebListener
 *
 * 想要生效需要在BootWebAdminApplication 上面添加注解  @ServletComponentScan
 * 效果：直接响应，没有spring 的拦截器
 */
@WebServlet(urlPatterns ="/my")
public class MyServlet extends HttpServlet {
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("springBoot 66666");
    }
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
